#include <bits/stdc++.h>

using namespace std;
using ll = long long;

set<ll> s;
vector<ll> a;

int t, n;

void init() {
    for (ll i = 1; i*i*i <= 1e9; i++) s.insert(i*i*i);
    for (ll i = 1; i*i <= 1e9; i++) s.insert(i*i);

    for (auto i : s) a.push_back(i);

}
int main() {
    init();
    cin >> t;
    while(t--) {
        cin >> n;

        int cnt = 0;
        for (auto x : a) {
            if (x <= n) cnt++;
        }
        cout << cnt << endl;
    }
}